/* ============================================================================ */

/* ============================================================================ */
/* Modal Styles */
/* ============================================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-index-modal);
  animation: fadeIn 0.3s ease-out;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

.modal-header {
  padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
}

.close-button {
  font-size: var(--font-size-3xl);
  color: var(--color-text-light);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-button:hover {
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-body p {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  line-height: var(--line-height-relaxed);
}

.modal-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.modal-link {
  display: block;
  padding: var(--spacing-md);
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  text-align: center;
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border-light);
}

.modal-link:hover {
  background-color: var(--color-primary);
  color: var(--color-bg-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.modal-footer {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--spacing-md);
  text-align: center;
}

.dont-show-again {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  cursor: pointer;
}

.dont-show-again input {
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================================================ */

/* CSS Custom Properties (Variables) */
:root {
  /* Color Palette */
  --color-primary: #0052d9;
  --color-primary-dark: #003ba3;
  --color-primary-darker: #001f66;
  --color-success: #10b981;
  --color-success-dark: #38a169;
  --color-success-darker: #48bb78;
  --color-error: #ef4444;
  --color-warning: #f59e0b;

  /* Text Colors */
  --color-text-primary: #1a202c;
  --color-text-secondary: #2d3748;
  --color-text-muted: #4a5568;
  --color-text-light: #6b7280;
  --color-text-lighter: #9ca3af;
  --color-text-lightest: #a0aec0;

  /* Background Colors */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f7fafc;
  --color-bg-tertiary: #f8fafc;
  --color-bg-quaternary: #edf2f7;
  --color-bg-gradient-start: #f7fafc;
  --color-bg-gradient-end: #edf2f7;

  /* Border Colors */
  --color-border-light: #e2e8f0;
  --color-border-medium: #d1d5db;
  --color-border-error: #feb2b2;

  /* Error/Success Background Colors */
  --color-bg-error: #fed7d7;
  --color-bg-error-border: #feb2b2;
  --color-error-text: #c53030;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 2.5rem;
  --spacing-3xl: 3rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(0, 82, 217, 0.1);
  --shadow-platform-detected: 0 0 0 2px rgba(16, 185, 129, 0.2);
  --shadow-platform-error: 0 0 0 2px rgba(239, 68, 68, 0.2);

  /* Typography */
  --font-family-primary:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",
    "Cantarell", sans-serif;
  --font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.5;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Z-index */
  --z-index-dropdown: 1000;
  --z-index-modal: 1050;
  --z-index-tooltip: 1100;
}

/* ============================================================================
   CSS Reset and Base Styles
   ============================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-primary);
  line-height: var(--line-height-base);
  color: var(--color-text-secondary);
  background: linear-gradient(
    135deg,
    var(--color-bg-gradient-start) 0%,
    var(--color-bg-gradient-end) 100%
  );
  min-height: 100vh;
}

/* ============================================================================
   Layout Components
   ============================================================================ */

/* Container and Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* ============================================================================
   Header Section
   ============================================================================ */
.header {
  text-align: center;
  margin-bottom: var(--spacing-3xl);
}

.title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================================
   Converter Section
   ============================================================================ */
.converter-section {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}

/* Initial state centering styles */
.converter-section:not(.has-content) {
  text-align: center;
}

.converter-section:not(.has-content) .input-group {
  margin-bottom: var(--spacing-lg);
  text-align: left;
}

.converter-section:not(.has-content) .platform-status {
  margin-bottom: 0;
}

/* ============================================================================
   Form Components
   ============================================================================ */

/* Input Groups */
.input-group {
  margin-bottom: var(--spacing-lg);
}

.label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: #374151;
  margin-bottom: var(--spacing-sm);
  text-transform: capitalize;
  letter-spacing: 0.05em;
}

.label-hint {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: normal;
  margin-left: var(--spacing-xs);
}

.input {
  width: 100%;
  padding: 0.875rem var(--spacing-md);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
  background: var(--color-bg-tertiary);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-bg-primary);
  box-shadow: var(--shadow-focus);
}

.input.error {
  border-color: var(--color-error);
  background: var(--color-bg-error);
}

.input.error:focus {
  box-shadow: var(--shadow-platform-error);
}

.input.output {
  background: var(--color-bg-secondary);
  font-family: var(--font-family-mono);
  font-size: 0.9rem;
}

/* ============================================================================
   Platform Detection Status
   ============================================================================ */
.platform-status {
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.platform-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-border-medium);
  transition: background-color var(--transition-fast);
}

.platform-dot.detected {
  background: var(--color-success);
  box-shadow: var(--shadow-platform-detected);
}

.platform-dot.error {
  background: var(--color-error);
  box-shadow: var(--shadow-platform-error);
}

/* ============================================================================
   Output Components
   ============================================================================ */
.output-container {
  display: flex;
  gap: var(--spacing-sm);
}

.output-container .input {
  flex: 1;
}

.copy-btn {
  padding: 0.875rem var(--spacing-md);
  background: var(--color-success-darker);
  color: var(--color-bg-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--color-success-dark);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: var(--color-primary);
}

.copy-icon {
  font-size: var(--font-size-base);
}

/* ============================================================================
   Result and Error States
   ============================================================================ */

/* Result Section */
.result-section {
  animation: slideIn var(--transition-normal) ease-out;
}

.result-section.hidden {
  display: none !important;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Error Message */
.error-message {
  padding: var(--spacing-md);
  background: var(--color-bg-error);
  color: var(--color-error-text);
  border: 1px solid var(--color-bg-error-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.error-message.hidden {
  display: none !important;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* ============================================================================
   Footer Section
   ============================================================================ */
.footer {
  margin-top: var(--spacing-3xl);
  text-align: center;
}

.footer-content {
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--color-border-light);
}

.footer-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.footer-links {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.footer-note {
  font-size: var(--font-size-xs);
  color: var(--color-text-lightest);
}

.footer-copyright {
  font-size: var(--font-size-xs);
  color: var(--color-text-lighter);
  margin-top: var(--spacing-sm);
  opacity: 0.8;
}

.footer-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-primary-darker);
  text-decoration: underline;
}

.footer-author-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  transition: all var(--transition-normal);
  position: relative;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-author-link:hover {
  transform: translateY(-1px);
  text-shadow: 0 2px 4px rgba(0, 82, 217, 0.3);
  -webkit-text-fill-color: var(--color-primary-darker);
}

.footer-author-link:active {
  transform: translateY(0);
}

/* ============================================================================
   Domains Section
   ============================================================================ */
.domains-section {
  margin: var(--spacing-xl) 0;
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.domains-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
}

.domains-header:hover {
  background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-quaternary) 100%);
}

.domains-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.domains-icon {
  font-size: var(--font-size-xl);
}

.domains-count {
  background: var(--color-primary);
  color: var(--color-bg-primary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  min-width: 2rem;
  text-align: center;
}

.domains-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-primary);
  color: var(--color-bg-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.domains-toggle-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.toggle-icon {
  transition: transform var(--transition-fast);
  display: inline-block;
}

.domains-section.expanded .toggle-icon {
  transform: rotate(180deg);
}

.domains-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow) ease-out;
}

.domains-section.expanded .domains-content {
  max-height: 80vh;
  overflow-y: auto;
}

.domains-description {
  padding: var(--spacing-lg) var(--spacing-lg) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.domains-description p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
  line-height: var(--line-height-relaxed);
}

.domains-grid {
  padding: var(--spacing-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.domain-category {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

.category-title {
  margin: 0;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-bg-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  text-align: center;
}

.domain-list {
  list-style: none;
  margin: 0;
  padding: var(--spacing-sm);
  max-height: 300px;
  overflow-y: auto;
}

.domain-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.domain-list li:hover {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-medium);
}

.domain-list li:last-child {
  margin-bottom: 0;
}

.domain-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  flex: 1;
  margin-right: var(--spacing-sm);
}

.domain-url {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-quaternary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
  flex-shrink: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scrollbar Styles for Domain Lists */
.domain-list::-webkit-scrollbar {
  width: 6px;
}

.domain-list::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
}

.domain-list::-webkit-scrollbar-thumb {
  background: var(--color-border-medium);
  border-radius: var(--radius-sm);
}

.domain-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-lighter);
}

.domains-content::-webkit-scrollbar {
  width: 8px;
}

.domains-content::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
}

.domains-content::-webkit-scrollbar-thumb {
  background: var(--color-border-medium);
  border-radius: var(--radius-sm);
}

.domains-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-lighter);
}

/* ============================================================================
   Domains Section Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
  .domains-header {
    padding: var(--spacing-md);
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
  }

  .domains-title {
    font-size: var(--font-size-base);
    flex-direction: column;
  }

  .domains-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
  }

  .domain-list {
    max-height: 250px;
  }

  .domain-name {
    font-size: var(--font-size-xs);
  }

  .domain-url {
    font-size: 0.7rem;
    max-width: 120px;
  }
}

@media (max-width: 480px) {
  .domains-section {
    margin: var(--spacing-lg) 0;
  }

  .domains-header {
    padding: var(--spacing-sm);
  }

  .domains-title {
    font-size: var(--font-size-sm);
  }

  .domains-grid {
    padding: var(--spacing-sm);
  }

  .domain-category {
    border-radius: var(--radius-sm);
  }

  .category-title {
    padding: var(--spacing-sm);
    font-size: var(--font-size-sm);
  }

  .domain-list {
    padding: var(--spacing-xs);
    max-height: 200px;
  }

  .domain-list li {
    padding: var(--spacing-xs);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .domain-name {
    margin-right: 0;
    font-size: var(--font-size-xs);
  }

  .domain-url {
    font-size: 0.6rem;
    max-width: 100%;
    text-align: center;
  }
}

/* ============================================================================
   Animations
   ============================================================================ */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-md) 0.75rem;
  }

  .title {
    font-size: var(--font-size-3xl);
  }

  .subtitle {
    font-size: var(--font-size-base);
  }

  .converter-section {
    padding: var(--spacing-lg);
  }

  .output-container {
    flex-direction: column;
  }

  .copy-btn {
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: var(--font-size-2xl);
  }

  .converter-section {
    padding: var(--spacing-md);
    margin: 0 var(--spacing-sm);
  }
}
